function classifyOption(dataList,dataValueList) {
	return {
		tooltip: {
		  show: true,
		  trigger: 'item',
		  formatter: "{b}: {c} ({d}%)"
		},

		legend: {
		  orient: 'horizontal',
		  left: "3%",
		  textStyle: {
			fontWeight: "normal",
			fontSize: 12,
			color: "#606266"
		  },
		  data:dataList
		  // data:['ATS','PSD','ACS','EMCS','FAS','UPS','EMCS2','PCSADA','AFC'],
		},
		series: [
			{
				type:'pie',
				selectedMode: 'single',
				radius : '50%',
				center: ['50%', '50%'],
				color: ["#AF89D6", "#5ab6df", "#6a8bc0", "#4acacb", "#fe8676"],
				top: '10',
				label: {
					normal: {
						formatter: "{b}\n{d}%",
						textStyle: {
							  color: '#606266',
							  fontWeight: "bold",
							  fontSize: 12
						}
					}
				},
				// data:[
				//   {value:335, name:'ATS'},
				//   {value:679, name:'PSD'},
				//   {value:1548, name:'ACS'},
				//   {value:335, name:'EMCS'},
				//   {value:679, name:'FAS'},
				//   {value:1548, name:'UPS'},
				//   {value:335, name:'EMCS2'},
				//   {value:679, name:'PCSADA'},
				//   {value:1548, name:'AFC'},
				// ],
				data:dataValueList,
				itemStyle: {
					normal: {
						label: {
							show: true,
							formatter: "{b} : {c} ({d}%)"
						},
						labelLine: { show: true }
					}
				}
			},
		]
	}
}

function systemHealthOption(systemHealth,echarts) {
	var labelFacade = {
		color: {
			type: 'linear',
			// x: 0,
			// y: 0,
			// x2: 0,
			// y2: 1,
			colorStops: [{
				offset: 0, color: '#00cefc' // 0% 处的颜色
			}, {
				offset: 1, color: '#367bec' // 100% 处的颜色
			}],
			global: false // 缺省为 false
		}
	}
	var lableFont = {
		normal: {
			formatter: "{d}%",
			position: "center",
			show: true,
			textStyle: {
				fontSize: "15",
				fontWeight: "normal",
				color: "#606266"
			}
		}
	}
	var labelFromatter = {
		normal: {
			label: {
				show: false
			},
			labelLine: {
				show: false
			}
		}
	}
	var titleStyle = {
		fontWeight: "normal",
		fontSize: 15,
		color: "#606266"
	}
	var radius = [35, 45];
	return {
		title: [
			{ text:systemHealth[0].system, left: "12%", top: "40%", textStyle: titleStyle },
			{ text:systemHealth[1].system, left: "46%", top: "40%", textStyle: titleStyle },
			{ text:systemHealth[2].system, left: "75%", top: "40%", textStyle: titleStyle }
		],
		color: ["rgba(176, 212, 251, 1)"],
		// backgroundColor: "#0D2A42",
		series: [
	     // EMCS占比98%
			{
				type: "pie",
				center: ["20%", "20%"],
				radius: radius,
				clockWise: true, //顺逆时针
				hoverAnimation: false, //鼠标悬停跳动
				x: "0%", // for funnel
				roseType: 'radius',
				itemStyle: labelFromatter,
				data: [
					{
						name: "EMCS",
						value: systemHealth[0].healthIndex,
						itemStyle: labelFacade,
						label: lableFont
					},
					{
						name: "residue",
						value: 100-systemHealth[0].healthIndex,
					}
				]
			},
			//FAS占比99%
			{
				type: "pie",
				center: ["40%", "20%"],
				clockWise: true, //顺逆时针
				hoverAnimation: false, //鼠标悬停跳动
				radius: radius,
				x: "20%", // for funnel
				roseType: 'radius',
				itemStyle: labelFromatter,
				data: [
					{
						name: "FAS",
						value: systemHealth[1].healthIndex,
						itemStyle: labelFacade,
						label: lableFont
					},
					{ 
						name: "residue", 
						value: 100-systemHealth[1].healthIndex ,
					}
				]
			},
			// 故障处理率96%
			{
				type: "pie",
				center: ["75%", "20%"],
				clockWise: true, //顺逆时针
				hoverAnimation: false, //鼠标悬停跳动
				radius: radius,
				x: "40%", // for funnel
				roseType: 'radius',
				itemStyle: labelFromatter,
				data: [
					{
					  name: "PSCADA",
					  value:systemHealth[2].healthIndex,
					  itemStyle: labelFacade,
					  label: lableFont
					},
					{ 
						name: "residue", 
						value: 100-systemHealth[2].healthIndex,
					}
				]
			},
		]
	}
}

function exchangePerformanceOption1(SwitchDataList) {
	var lableStyle = {
		normal: {
			textStyle: {
				color: '#fff',
				insideColor: '#fff',
				fontSize: 12
			}
		}
	}
	var lableStyle1 = {
		normal: {
			formatter: '{c}℃',
			textStyle: {
				color: '#fff',
				insideColor: '#fff',
				fontSize: 12
			}
		}
	}
	var outlineStyle = {
		show: true,
		borderDistance: 4,
		itemStyle: {
			color: "none",
			borderColor: "#1f5888",
			borderWidth: 4
		}
	}
	var textStyleText = {
		fontSize: 12,
		color: "#606266"
	}
	var textStyleTextt = {
		fontSize: 14,
		color: "#606266"
	}
	return {
		// backgroundColor: "#0D2A42",
		title: [
			{
				text: SwitchDataList[1][0],
				textStyle: textStyleTextt,
				left: "10%",
				top: "25%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: SwitchDataList[0][0],
				textStyle: textStyleTextt,
				left: "10%",
				top: "72%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "CPU使用率",
				textStyle: textStyleText,
				left: "34%",
				top: "43%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "内存使用率",
				textStyle: textStyleText,
				left: "59%",
				top: "43%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "温度",
				textStyle:textStyleText,
				left: "84%",
				top: "43%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "CPU使用率",
				textStyle: textStyleText,
				left: "34%",
				top: "93%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "内存使用率",
				textStyle: textStyleText,
				left: "59%",
				top: "93%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "温度",
				textStyle: textStyleText,
				left: "84%",
				top: "93%",
				textAlign: "center",
				textBaseAlign: "middle"
			}
		],
		series: [
			{
				type: "gauge",
				data:[SwitchDataList[1][1].resultCpuLoad/100],
				label: lableStyle,
				radius: "28%",
				shape: "rect",
				// 水球颜色
				color: ["#1f5888"],
				center: ["35%", "25%"],
				// 内图 背景色 边
				backgroundStyle: {
					color: "#0D2A42"
				},
				outline: outlineStyle
			},
			{
				type: "gauge",
				data:[SwitchDataList[1][1].resultMemoryUsage/100],
				label: lableStyle,
				shape: "rect",
				radius: "28%",
				// 水球颜色
				color: ["#1f5888"],
				center: ["60%", "25%"],
				// 内图 背景色 边
				backgroundStyle: {
					color: "#0D2A42"
				},
				outline: outlineStyle
			},
			{
				type: "gauge",
				data:[SwitchDataList[1][1].resultTemperature],
				label: lableStyle1,
				shape: "rect",
				radius: "28%",
				// 水球颜色
				color: ["#1f5888"],
				center: ["85%", "25%"],
				// 内图 背景色 边
				backgroundStyle: {
					color: "#0D2A42"
				},
				outline: outlineStyle
			},
			{
				type: "gauge",
				data:[SwitchDataList[0][1].resultCpuLoad/100],
				label: lableStyle,
				shape: "rect",
				radius: "30%",
				// 水球颜色
				color: ["#1f5888"],
				center: ["35%", "75%"],
				// 内图 背景色 边
				backgroundStyle: {
					color: "#0D2A42"
				},
				outline: outlineStyle
			},
			{
				type: "gauge",
				data:[SwitchDataList[0][1].resultMemoryUsage/100],
				label: lableStyle,
				shape: "rect",
				radius: "28%",
				// 水球颜色
				color: ["#1f5888"],
				center: ["60%", "75%"],
				// 内图 背景色 边
				backgroundStyle: {
					color: "#0D2A42"
				},
				outline: outlineStyle
			},
			{
				type: "gauge",
				data:[SwitchDataList[0][1].resultTemperature],
				label: lableStyle1,
				shape: "rect",
				radius: "28%",
				// 水球颜色
				color: ["#1f5888"],
				center: ["85%", "75%"],
				// 内图 背景色 边
				backgroundStyle: {
					color: "#0D2A42"
				},
				outline: outlineStyle
			}
		],
	}
}

function exchangePerformanceOption(SwitchDataList) {
	let titleStyle = {               //设置仪表盘中间显示文字样式
		textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
			fontWeight: 'bolder',
			fontSize: 10,
			fontStyle: 'italic',
		}
	}
	let splitLine = {           //分割线样式（及10、20等长线样式）
		length : 15,
		lineStyle: {            // 分隔线样式。
			color: "#eee",              //线的颜色,默认 #eee。
			opacity: 1,                 //图形透明度。支持从 0 到 1 的数字，为 0 时不绘制该图形。
			width: 2,                   //线度,默认 2。
			type: "solid",              //线的类型,默认 solid。 此外还有 dashed,dotted
			shadowBlur: 10,             //(发光效果)图形阴影的模糊大小。该属性配合 shadowColor,shadowOffsetX, shadowOffsetY 一起设置图形的阴影效果。
			shadowColor: "#606266",        //阴影颜色。支持的格式同color。
		}
	}
	let detail = {
		offsetCenter: [0,"80%"],    //设置仪表盘下方显示内容位置
		formatter: function(value){
			if(parseInt(value) < 1){
				return value*100+'%'
			} else {
				return value + '°'
			}	
			
		},
		textStyle:{color:'#606266',fontSize:18},
	}
	let pointer = {
		length: '50%',
		width: 4
	}
	let axisLine = {
		show : true,// 是否显示仪表盘轴线(轮廓线),默认 true。
		lineStyle : { // 属性lineStyle控制线条样式
			shadowBlur: 10,             //(发光效果)图形阴影的模糊大小。该属性配合 shadowColor,shadowOffsetX, shadowOffsetY 一起设置图形的阴影效果。
			shadowColor: "#606266",        //阴影颜色。支持的格式同color。
			color : [ //表盘颜色
				[ 0.3, "#20AE51" ],//0-50%处的颜色
				[ 0.7, "#FF9618" ],//51%-70%处的颜色
				// [ 0.9, "#FFED44" ],//70%-90%处的颜色
				[ 1,"#DA462C" ]//90%-100%处的颜色
			],
			width : 15//表盘宽度
		}
	}
	let axisLabel = { //文字样式（及“10”、“20”等文字样式）
		show: false,
		// color : "#606266",
		// distance : 5 //文字离表盘的距离
	}
	let textStyleTextt = {
		fontSize: 14,
		color: "#606266"
	}
	let textStyleText = {
		fontSize: 12,
		color: "#606266"
	}
	return {
		// backgroundColor: "#0D2A42",
		title: [
			{
				text: SwitchDataList[1][0],
				textStyle: textStyleTextt,
				left: "50%",
				top: "3%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: SwitchDataList[0][0],
				textStyle: textStyleTextt,
				left: "50%",
				top: "53%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "CPU使用率",
				textStyle: textStyleText,
				left: "18%",
				top: "43%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "内存使用率",
				textStyle: textStyleText,
				left: "48%",
				top: "43%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "温度",
				textStyle:textStyleText,
				left: "78%",
				top: "43%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "CPU使用率",
				textStyle: textStyleText,
				left: "18%",
				top: "93%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "内存使用率",
				textStyle: textStyleText,
				left: "48%",
				top: "93%",
				textAlign: "center",
				textBaseAlign: "middle"
			},
			{
				text: "温度",
				textStyle: textStyleText,
				left: "78%",
				top: "93%",
				textAlign: "center",
				textBaseAlign: "middle"
			}
		],
		series: [
			{
				type: "gauge",
				data:[{value: SwitchDataList[1][1].resultCpuLoad/100, name: ''}],
				radius: "28%",
				center: ["20%", "30%"],
				detail: detail,
				title : titleStyle,
				splitLine : splitLine,
				pointer: pointer,
				axisLine: axisLine,
				axisLabel : axisLabel,
			},
			{
				type: "gauge",
				data:[{value: SwitchDataList[1][1].resultMemoryUsage/100, name: ''}],
				radius: "28%",
				center: ["50%", "30%"],
				detail: detail,
				title : titleStyle,
				splitLine : splitLine,
				pointer: pointer,
				axisLine: axisLine,
				axisLabel : axisLabel,
			},
			{
				type: "gauge",
				data:[{value: SwitchDataList[1][1].resultTemperature, name: ''}],
				radius: "28%",
				center: ["80%", "30%"],
				detail: detail,
				title : titleStyle,
				splitLine : splitLine,
				pointer: pointer,
				axisLine: axisLine,
				axisLabel : axisLabel,
			},
			{
				type: "gauge",
				data:[{value: SwitchDataList[0][1].resultCpuLoad/100, name: ''}],
				radius: "28%",
				center: ["20%", "80%"],
				detail: detail,
				title : titleStyle,
				splitLine : splitLine,
				pointer: pointer,
				axisLine: axisLine,
				axisLabel : axisLabel,
			},
			{
				type: "gauge",
				data:[{value: SwitchDataList[0][1].resultMemoryUsage/100, name: ''}],
				radius: "28%",
				center: ["50%", "80%"],
				detail: detail,
				title : titleStyle,
				splitLine : splitLine,
				pointer: pointer,
				axisLine: axisLine,
				axisLabel : axisLabel,
			},
			{
				type: "gauge",
				data:[{value: SwitchDataList[0][1].resultTemperature, name: ''}],
				radius: "28%",
				center: ["80%", "80%"],
				detail: detail,
				title : titleStyle,
				splitLine : splitLine,
				pointer: pointer,
				axisLine: axisLine,
				axisLabel : axisLabel,
			},
		],
	}
}

function faultStatisticsOption(deviceFailureValueList,deviceFailureList) {
	return {
		grid: {
			left: '12%',
			top: '5%',
			bottom: '12%',
			right: '8%'
		},
		xAxis: {
			data: deviceFailureList,
			axisTick: {
				show: false
			},
			axisLine: {
				lineStyle: {
					color: 'rgba(0,77,167,1)',
					width: 2 //这里是为了突出显示加上的
				}
			},
			axisLabel: {
				textStyle: {
					color: '#606266',
					fontSize: 12
				}
			}
		},
		yAxis: [
			{
				splitNumber: 2,
				axisTick: {
					show: false
				},
				axisLine: {
					lineStyle: {
						color: 'rgba(0,77,167,1)',
						width: 2 //这里是为了突出显示加上的
					}
				},
				axisLabel: {
					textStyle: {
						color: '#606266'
					}
				},
				splitArea: {
					areaStyle: {
						color: 'rgba(255,255,255,.5)'
					}
				},
				splitLine: {
					show: true,
					lineStyle: {
						color: 'rgba(255, 129, 109, 0.1)',
						width: 0.5,
						type: 'dashed'
					}
				}
			}
		],
		series: [{
			name: 'hill',
			type: 'pictorialBar',
			barCategoryGap: '0%',
			symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
			label: {
				show: true,
				position: 'top',
				distance: 15,
				color: 'rgba(0,77,167,1)',
				fontWeight: 'bolder',
				fontSize: 20,
			},
			itemStyle: {
				normal: {
					color: {
						type: 'linear',
						x: 0,
						y: 0,
						x2: 0,
						y2: 1,
						colorStops: [{
								offset: 0,
								color: 'rgba(0,244,255,1)' //  0%  处的颜色
							},
							{
								offset: 1,
								color: 'rgba(0,77,167,1)' //  100%  处的颜色
							}
						],
						global: false //  缺省为  false
					}
				},
				emphasis: {
					opacity: 1
				}
			},
			data: deviceFailureValueList,
			z: 10
		}]
	}
}

function classificationStatisticsOption(MGTcpuData){
	return {
		// backgroundColor: "#0D2A42",
		xAxis: {
			show: false
		},
		grid: {
			left:'30%',
			top:'5%'
		},
		yAxis: [
			{
				show: true,
				data:MGTcpuData.name,
				// data: ['接口服务1','实时服务2','实时服务1','历史服务2','接口服务2','历史服务1'],
				inverse: true,
				axisLine: {
					show: false
				},
				splitLine: {
					show: false
				},
				axisTick: {
					show: false
				},
				axisLabel: {
					textStyle: {
						fontSize: 14,
						color: "#606266"
					},
					formatter: function(value, index) {
						return [value].join("\n");
					}
				}
			},
			{
				show: false,
				inverse: true,
				data:['2'],
				axisLabel: {
					textStyle: {
						fontSize: 12,
						color: "#606266"
					}
				},
				axisLine: {
					show: false
				},
				splitLine: {
					show: false
				},
				axisTick: {
					show: false
				}
			}
		],
		xAxis: [{
			show:false,
			type: "value",
			// max: 100,
			splitLine: {
				show: false
			},
			axisLine: {
				show: false
			},
			axisTick: {
				show: false
			},
			axisLabel: {
				color: "#606266"
			}
		}],
		series: [
			{
				name: "条",
				type: "bar",
				yAxisIndex: 0,
				data:MGTcpuData.value,
				// data: ['11.1','15.8','25.1','20.6','10.2','17.0'],
				barWidth: "35%",
				itemStyle: {
					normal: {
						barBorderRadius: 15,
						color: "#56D0E3"
					}
				},
				label: {
					normal: {
						show: true,
						position: 'right',
						formatter: '{c}%',
					}
				}
			},
			{ 
				name: '外框',
				type: 'bar',
				yAxisIndex: 0,
				barGap: '-100%',
				data: MGTcpuData.all,
				barWidth: '35%',
				itemStyle: {
					normal: {
						color: "none",
						borderColor: "#00c1de",
						borderWidth: 2,
						barBorderRadius: 15
					}
				},
			}, 
		]
	}
}

export { //很关键
 classifyOption,
 systemHealthOption,
 exchangePerformanceOption,
 faultStatisticsOption,
 classificationStatisticsOption
}
